package AGMap;


// <editor-fold defaultstate="collapsed" desc=" UML Marker ">
// #[regen=yes,id=DCE.559FB90A-0592-32C0-F33D-27D29460B9BE]
// </editor-fold>
public class Commerce extends Lieu {

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,id=DCE.96E34E46-8F6E-F620-30E5-EC1C00F3DBBB]
    // </editor-fold>
  //  private int id;
   // static int lastId=1;
    private Database bdd =new Database("com.mysql.jdbc.Driver");;

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,id=DCE.FB05BB5D-09E5-E31F-982E-06EF8972B275]
    // </editor-fold>
    public Commerce (String nom,String adresse,int latitude,int longitude,Ville ville) {

        super(nom,adresse,p);
       // this.id=lastId++;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,regenBody=yes,id=DCE.D2AA0C55-A3F7-FD43-6A84-0218E1742604]
    // </editor-fold>
   /* public int getId () {
        return id;
    }*/

    public void ajouterCommerce(Commerce com){

       String requete = "INSERT INTO commerces(nom,adresse,latitude,longitude,statut) VALUES('" +
                        com.getNom() + "','" + com.getAdresse() + "','" +
                        getLatitude() + "','" + getLongitude() + "','modifiable')";

       bdd.Update(requete);
    }

    public void listeCommerce(){

        String requete = "SELECT * FROM commerces";

       bdd.Execute(requete);
    }
}

